package events

import (
	"time"
)

// 文章相关事件类型常量
const (
	ArticleCreatedEventType          = "article.created"
	ArticleUpdatedEventType          = "article.updated"
	ArticleDeletedEventType          = "article.deleted"
	ArticlePublishedEventType        = "article.published"
	ArticleArchivedEventType         = "article.archived"
	ArticleDraftedEventType          = "article.drafted"
	ArticleStatusChangedEventType    = "article.status_changed"
	ArticleRecommendChangedEventType = "article.recommend_changed"
)

// ArticleCreatedEvent 文章创建事件
type ArticleCreatedEvent struct {
	ID         uint      `json:"id"`
	Title      string    `json:"title"`
	AuthorID   uint      `json:"author_id"`
	CategoryID uint      `json:"category_id"`
	CreatedAt  time.Time `json:"created_at"`
}

// ArticleUpdatedEvent 文章更新事件
type ArticleUpdatedEvent struct {
	ID         uint      `json:"id"`
	Title      string    `json:"title"`
	AuthorID   uint      `json:"author_id"`
	CategoryID uint      `json:"category_id"`
	UpdatedAt  time.Time `json:"updated_at"`
}

// ArticleDeletedEvent 文章删除事件
type ArticleDeletedEvent struct {
	ID        uint      `json:"id"`
	Title     string    `json:"title"`
	AuthorID  uint      `json:"author_id"`
	DeletedAt time.Time `json:"deleted_at"`
}

// ArticlePublishedEvent 文章发布事件
type ArticlePublishedEvent struct {
	ID          uint      `json:"id"`
	Title       string    `json:"title"`
	AuthorID    uint      `json:"author_id"`
	CategoryID  uint      `json:"category_id"`
	PublishedAt time.Time `json:"published_at"`
}

// ArticleArchivedEvent 文章归档事件
type ArticleArchivedEvent struct {
	ID         uint      `json:"id"`
	Title      string    `json:"title"`
	AuthorID   uint      `json:"author_id"`
	ArchivedAt time.Time `json:"archived_at"`
}

// ArticleDraftedEvent 文章设为草稿事件
type ArticleDraftedEvent struct {
	ID        uint      `json:"id"`
	Title     string    `json:"title"`
	AuthorID  uint      `json:"author_id"`
	DraftedAt time.Time `json:"drafted_at"`
}

// ArticleStatusChangedEvent 文章状态变更事件
type ArticleStatusChangedEvent struct {
	ID             uint      `json:"id"`
	Title          string    `json:"title"`
	AuthorID       uint      `json:"author_id"`
	PreviousStatus uint      `json:"previous_status"`
	CurrentStatus  uint      `json:"current_status"`
	ChangedAt      time.Time `json:"changed_at"`
}

// ArticleRecommendChangedEvent 文章推荐状态变更事件
type ArticleRecommendChangedEvent struct {
	ID                uint      `json:"id"`
	Title             string    `json:"title"`
	AuthorID          uint      `json:"author_id"`
	PreviousRecommend bool      `json:"previous_recommend"`
	CurrentRecommend  bool      `json:"current_recommend"`
	ChangedAt         time.Time `json:"changed_at"`
}
